<!------------------- 头部CSS部分 start-------------------------------------------------------------------------------->
{include file="Public/head"/}
<!------------------- 头部CSS部分 end---------------------------------------------------------------------------------->

<body class="no-skin">

<!---------------------头部消息栏,用户栏 start------------------------------------------------------------------------->
{include file="Public/header"/}
<!---------------------头部消息栏,用户栏 end--------------------------------------------------------------------------->

<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <!-------------------------菜单栏 start---------------------------------------------------------------------------->
    {include file="Public/menu"/}
    <!-------------------------菜单栏 end------------------------------------------------------------------------------>

    <div class="main-content">
        <div class="main-content-inner">

            <!-------------------------------路径导航 面包屑 start--------------------------------------------->
            {include file="Public/breadcrumbs"/}
            <!-------------------------------路径导航 面包屑 end----------------------------------------------->

            <div class="page-content">

                <!-----------------------------右侧设置 页面提示消息 start------------------------------------->
                {include file="Public/set"/}
                <!-----------------------------右侧设置 页面提示消息 end--------------------------------------->

                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <div class="cf">
                                <a class="btn btn-info" href="{:url('Menu/adminMenu')}">新增</a>
                            </div>
                            <div class="space-4"></div>
                            <form id="form" method="post" action="{:url('Menu/adminDel')}">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th class="center">
                                            ID
                                            <!--<input class="check-all" type="checkbox" value=""> 选择所有-->
                                        </th>
                                        <th>菜单名称</th>
                                        <th>链接</th>
                                        <th>ICON</th>
                                        <th class="center">状态</th>
                                        <th>排序</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="list" id="val"}
                                        <tr>
                                            <td class="center">
                                                {$val.id}
                                                <!--<input class="ids" type="checkbox" name="ids[]" value="{$val.id}">-->
                                            </td>
                                            <td>{$val.name}</td>
                                            <td>{$val.url}</td>
                                            <td><i class="{$val.icon}"></i></td>
                                            <td class="center">
                                                {if condition="$val.status eq 1"}
                                                    显示
                                                    {else/}
                                                    隐藏
                                                {/if}
                                            </td>
                                            <td>{$val.sort}</td>
                                            <td class="center">
                                                <a href="{:url('Menu/adminMenu',array('id'=>$val.id))}">修改</a>&nbsp;
                                                <a class="del" href="javascript:;" val="{:url('Menu/adminDel',array('ids'=>$val.id))}" title="删除">删除</a>
                                            </td>
                                        </tr>
                                        {notempty name="val.children"}
                                            {volist name="val.children" id="v"}
                                                <tr>
                                                    <td class="center">
                                                        {$v.id}
                                                        <!--<input class="ids" type="checkbox" name="ids[]" value="{$v.id}">-->
                                                    </td>
                                                    <td>┗━{$v.name}</td>
                                                    <td>{$v.url}</td>
                                                    <td><i class="{$v.icon}"></i></td>
                                                    <td class="center">
                                                        {if condition="$v.status eq 1"}
                                                            显示
                                                            {else/}
                                                            隐藏
                                                        {/if}
                                                    </td>
                                                    <td>{$v.sort}</td>
                                                    <td class="center">
                                                        <a href="{:url('Menu/adminMenu',array('id'=>$v.id))}">修改</a>&nbsp;
                                                        <a class="del" href="javascript:;" val="{:url('Menu/adminDel',array('ids'=>$v.id))}" title="删除">删除</a>
                                                    </td>
                                                </tr>
                                                {notempty name="v.children"}
                                                    {volist name="v.children" id="vv"}
                                                        <tr>
                                                            <td class="center">
                                                                {$vv.id}
                                                                <!--<input class="ids" type="checkbox" name="ids[]" value="{$vv.id}">-->
                                                            </td>
                                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;┗━{$vv.name}</td>
                                                            <td>{$vv.url}</td>
                                                            <td><i class="{$vv.icon}"></i></td>
                                                            <td class="center">
                                                                {if condition="$vv.status eq 1"}
                                                                    显示
                                                                    {else/}
                                                                    隐藏
                                                                {/if}
                                                            </td>
                                                            <td>{$vv.sort}</td>
                                                            <td class="center">
                                                                <a href="{:url('Menu/adminMenu',array('id'=>$vv.id))}">修改</a>&nbsp;
                                                                <a class="del" href="javascript:;" val="{:url('Menu/adminDel',array('ids'=>$vv.id))}" title="删除">删除</a>
                                                            </td>
                                                        </tr>
                                                    {/volist}
                                                {/notempty}
                                            {/volist}
                                        {/notempty}
                                    {/volist}
                                    </tbody>
                                </table>
                            </form>
                            <div class="cf">
                                <!--<input id="submit" class="btn btn-info" type="button" value="删除所选">-->
                            </div>
                            {//$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--------------------------------底部版权 置顶 start------------------------------------------------------>
    {include file="Public/footer"/}
    <!--------------------------------底部版权 置顶 end-------------------------------------------------------->

</div>

<!--------------------------------------底部JS start----------------------------------------------------------->
{include file="Public/footerjs"/}
<!--------------------------------------底部JS end------------------------------------------------------------->

<script type="text/javascript">
    $(function () {
        $(".check-all").click(function () {
            $(".ids").prop("checked", this.checked);
        });
        $(".ids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.confirm({
                title: "系统提示",
                message: "确定要删除所选？<br/><font color='red'>如删除父级菜单会删除该父级菜单下的所有菜单</font>",
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "确定要删除?<br/><font color='red'>如删除父级菜单会删除该父级菜单下的所有菜单</font>",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
